package com.dgut.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dgut.dto.StatisticAO;
import com.dgut.pojo.DailyForm;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public interface DailyFormMapper extends BaseMapper<DailyForm> {
    @Select("select d.*,username,info_id,name,identity_category,department,gender,classname from dailyform d " +
            "inner join userinfo u on d.account_id=u.account_id " +
            "inner join account a on a.account_id=d.account_id ${ew.customSqlSegment}")
    public List<Map<String,Object>> getFormList(Page page, @Param(Constants.WRAPPER) Wrapper wrapper);

    @Select("select count(*) as count,DATE(create_time) as date from dailyform ${ew.customSqlSegment}")
    public List<StatisticAO> getFormCount(@Param(Constants.WRAPPER) Wrapper wrapper);
}

